<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>意图分类器设计文档</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
        }
        .serif-font {
            font-family: 'Noto Serif SC', serif;
        }
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .code-block {
            background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
            border-radius: 12px;
            overflow: hidden;
        }
        .mode-card {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        }
        .do-mode-accent {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .spec-mode-accent {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        }
        .floating-icon {
            animation: float 3s ease-in-out infinite;
        }
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="relative overflow-hidden bg-white">
        <div class="absolute inset-0 bg-gradient-to-br from-purple-50 via-pink-50 to-blue-50 opacity-70"></div>
        <div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-24">
            <div class="text-center">
                <div class="inline-flex items-center justify-center w-20 h-20 bg-gradient-to-br from-purple-500 to-pink-500 rounded-full mb-8 floating-icon">
                    <i class="fas fa-brain text-white text-3xl"></i>
                </div>
                <h1 class="text-5xl md:text-6xl font-bold mb-6 serif-font">
                    <span class="gradient-text">智能意图分类器</span>
                </h1>
                <p class="text-xl md:text-2xl text-gray-600 max-w-3xl mx-auto leading-relaxed">
                    为语言模型精准识别用户意图，智能区分执行模式与规范模式
                </p>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
        <!-- Overview Section -->
        <section class="mb-20">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <div class="flex items-center mb-6">
                    <i class="fas fa-info-circle text-3xl text-purple-600 mr-4"></i>
                    <h2 class="text-3xl font-bold">系统概述</h2>
                </div>
                <p class="text-lg text-gray-700 leading-relaxed mb-8">
                    意图分类器是一个专门为语言模型设计的智能系统，通过分析用户的对话历史和当前输入，
                    将用户意图精准分类为两种主要模式：<strong class="text-purple-600">执行模式（Do mode）</strong>
                    和<strong class="text-pink-600">规范模式（Spec mode）</strong>。
                    系统返回一个包含三个置信度值的JSON对象，确保总和始终为1。
                </p>
                
                <!-- Visual Diagram -->
                <div class="bg-gray-50 rounded-xl p-6">
                    <div class="mermaid">
                        graph TD
                            A[用户输入] --> B{意图分类器}
                            B --> C[分析对话历史]
                            B --> D[识别关键词]
                            B --> E[判断语法结构]
                            C --> F{分类决策}
                            D --> F
                            E --> F
                            F --> G[Do Mode<br/>默认选择]
                            F --> H[Spec Mode<br/>特定请求]
                            G --> I[JSON输出]
                            H --> I
                            I --> J[{chat: 0.0, do: 0.9, spec: 0.1}]
                            
                            style A fill:#f9f,stroke:#333,stroke-width:2px
                            style B fill:#bbf,stroke:#333,stroke-width:2px
                            style G fill:#9f9,stroke:#333,stroke-width:2px
                            style H fill:#f99,stroke:#333,stroke-width:2px
                            style J fill:#ff9,stroke:#333,stroke-width:2px
                    </div>
                </div>
            </div>
        </section>

        <!-- Mode Cards -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold text-center mb-12">分类模式详解</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Do Mode Card -->
                <div class="mode-card rounded-2xl shadow-xl overflow-hidden card-hover">
                    <div class="do-mode-accent h-2"></div>
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-play text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold">执行模式 (Do Mode)</h3>
                        </div>
                        <p class="text-gray-700 mb-6">默认选择，适用于大多数请求</p>
                        
                        <div class="space-y-4">
                            <div class="bg-white rounded-lg p-4">
                                <h4 class="font-semibold text-purple-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>适用场景
                                </h4>
                                <ul class="space-y-2 text-gray-600">
                                    <li>• 非规范创建相关的请求</li>
                                    <li>• 代码或工作空间修改</li>
                                    <li>• 命令式句子（动词开头）</li>
                                    <li>• 信息查询和解释请求</li>
                                    <li>• 疑问句（以问号结尾）</li>
                                </ul>
                            </div>
                            
                            <div class="bg-purple-50 rounded-lg p-4">
                                <h4 class="font-semibold text-purple-700 mb-2">
                                    <i class="fas fa-code mr-2"></i>示例
                                </h4>
                                <ul class="space-y-1 text-sm text-gray-700">
                                    <li>• "编写一个字符串反转函数"</li>
                                    <li>• "创建 index.js 文件"</li>
                                    <li>• "修复语法错误"</li>
                                    <li>• "JavaScript 中的 Promise 如何工作？"</li>
                                    <li>• "解释这段代码"</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Spec Mode Card -->
                <div class="mode-card rounded-2xl shadow-xl overflow-hidden card-hover">
                    <div class="spec-mode-accent h-2"></div>
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <div class="w-12 h-12 bg-pink-100 rounded-full flex items-center justify-center mr-4">
                                <i class="fas fa-file-alt text-pink-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold">规范模式 (Spec Mode)</h3>
                        </div>
                        <p class="text-gray-700 mb-6">仅用于特定规范/计划请求</p>
                        
                        <div class="space-y-4">
                            <div class="bg-white rounded-lg p-4">
                                <h4 class="font-semibold text-pink-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>适用场景
                                </h4>
                                <ul class="space-y-2 text-gray-600">
                                    <li>• 明确要求创建规范文档</li>
                                    <li>• 使用"spec"或"specification"关键词</li>
                                    <li>• 创建正式需求文档</li>
                                    <li>• 执行现有规范中的任务</li>
                                </ul>
                            </div>
                            
                            <div class="bg-pink-50 rounded-lg p-4">
                                <h4 class="font-semibold text-pink-700 mb-2">
                                    <i class="fas fa-code mr-2"></i>示例
                                </h4>
                                <ul class="space-y-1 text-sm text-gray-700">
                                    <li>• "为这个功能创建规范"</li>
                                    <li>• "生成登录系统的规范文档"</li>
                                    <li>• "执行 my-feature 规范中的任务 3.2"</li>
                                    <li>• "开始下一个任务"</li>
                                    <li>• "功能规范中的下一个任务是什么？"</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Important Notes -->
        <section class="mb-20">
            <div class="bg-gradient-to-r from-yellow-50 to-orange-50 rounded-2xl p-8 md:p-12 border-2 border-yellow-200">
                <div class="flex items-center mb-6">
                    <i class="fas fa-exclamation-triangle text-3xl text-yellow-600 mr-4"></i>
                    <h2 class="text-3xl font-bold">重要说明</h2>
                </div>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-white rounded-lg p-6">
                        <h3 class="font-semibold text-lg mb-3 text-orange-700">
                            <i class="fas fa-balance-scale mr-2"></i>默认原则
                        </h3>
                        <p class="text-gray-700">
                            当存在疑问时，系统默认分类为"执行模式"。只有在用户明确请求创建或处理正式规范文档时，
                            才会分类为"规范模式"。
                        </p>
                    </div>
                    <div class="bg-white rounded-lg p-6">
                        <h3 class="font-semibold text-lg mb-3 text-orange-700">
                            <i class="fas fa-history mr-2"></i>上下文考虑
                        </h3>
                        <p class="text-gray-700">
                            系统会综合考虑历史对话记录和最新用户消息。之前的消息可能包含重要上下文，
                            需要与最新回复结合分析。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Output Format -->
        <section class="mb-20">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <div class="flex items-center mb-6">
                    <i class="fas fa-code text-3xl text-blue-600 mr-4"></i>
                    <h2 class="text-3xl font-bold">输出格式</h2>
                </div>
                <p class="text-lg text-gray-700 mb-6">
                    系统仅返回JSON对象，不包含任何解释、评论或额外文本。三个属性值的总和必须等于1。
                </p>
                <div class="code-block p-6">
                    <pre class="text-white font-mono text-sm md:text-base"><code>{
  "chat": 0.0,
  "do": 0.9,
  "spec": 0.1
}</code></pre>
                </div>
            </div>
        </section>

        <!-- Interactive Demo -->
        <section>
            <div class="bg-gradient-to-br from-purple-100 to-pink-100 rounded-2xl p-8 md:p-12">
                <div class="text-center mb-8">
                    <i class="fas fa-flask text-4xl text-purple-600 mb-4"></i>
                    <h2 class="text-3xl font-bold mb-4">工作流程示意</h2>
                    <p class="text-gray-700">了解意图分类器如何处理不同类型的用